<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style>

	</style>
	<body>
		<div id="app">
			<h5>
				<p class="typewriter">{{typedata}}</p>
			</h5>
		</div>
	</body>
	<script src="./js/vue.js"></script>
	<script>
		var app = new Vue({
			el: "#app",
			data: {
				typedata: '',
				str: 'welcome to 苏苏就是小苏苏',
				timer: '',
				i: 0,
			},
			methods: {
				typeing() {
					if(this.i<=this.str.length){
						this.typedata = this.str.slice(0, this.i++)
						this.timer = setTimeout(()=>{
							this.typeing()
						}, 150);
						
					}else{
						clearTimeout(this.timer)
						// this.i=0;
						// this.typeing()
					}
					console.log(this.timer)
				},
			},
			mounted() {
				this.typeing()
			}
		})
	</script>
</html>
